<template>
    <view class="viewBox">
        <uni-nav-bar leftIcon="back" @clickLeft="back" :statusBar="true" shadow :fixed="true" title="详情" color="#101010"
            backgroundColor="#fff"></uni-nav-bar>
        <!-- <view class="title">
            <view class="head">
                <p style="margin-bottom: 10rpx;">事件名称:</p>
                <p>{{ info.eventName }}</p>
            </view>
            <tui-tag type="danger" padding="10rpx 14rpx" size="26rpx">未完成</tui-tag>
        </view>
        <view class="desc">
            <p>事发地址：{{ info.eventAddr }}</p>
            <p>事发时间：{{ info.eventTime }}</p>
            <p>事件描述：12</p>
            <p>事件级别：{{ info.eventLevel }}</p>
            <p>涉及人数：12</p>
        </view> -->

        <!-- 网格员端 一周巡查 -->
        <view v-if="userInfo.roleCode == 'wgy' && type== 'yz'" class="infobox">
            <view class="title">
                <view class="head">
                    <p style="margin-bottom: 10rpx;">详情如下</p>
                </view>
                <!-- <tui-tag :type="{{info.status==0 &&'danger'||'green'}}" padding="10rpx 14rpx" size="26rpx">{{ info.status==0 && '未完成' || '已完成' }}</tui-tag> -->
            </view>
            <view class="time">完成状态：<text :class="[info.status==0 && 'red' || 'green']">{{ info.status==0 && '未完成'||'已完成' }}</text></view>
            <view class="time">乡镇街道：{{ info.street }}</view>
            <view class="time">教别：{{ info.religion }}</view>
            <view class="time">场所名称：{{ info.place }}</view>
            <view class="time">巡查时间：{{ info.checkTime }}</view>
            <view class="time">巡查人员：{{ info.checkPerson }}</view>
            <view class="time">四进一提醒是否规范：{{ info.normFlag == 1 && '是' || '否' }}</view>
            <view class="time">是否有未成年人参加ZJ活动：{{ info.minorityFlag == 1 && '是' || '否' }}</view>
            <view class="time">是否有ZJ类非法出版物： {{ info.illegalFlag == 1 && '是' || '否' }}</view>
            <view class="time">是否发现其他问题：{{ info.otherFlag == 1 && '是' || '否' }}</view>
            <view class="time">情况反馈：{{ info.feedback }}</view>
        </view>
        <!-- 各单位端 专项巡查 -->
        <view v-else-if="userInfo.roleCode == 'gdw' && type == 'zx'" class="infobox">
            <view class="title">
                <view class="head">
                    <p style="margin-bottom: 10rpx;">详情如下</p>
                </view>
                <!-- <tui-tag type="danger" padding="10rpx 14rpx" size="26rpx">{{ info.status==0 && '未完成' || '已完成' }}</tui-tag> -->
            </view>
            <view class="time">完成状态：<text :class="[info.status==0 && 'red' || 'green']">{{ info.status==0 && '未完成'||'已完成' }}</text></view>
            <view class="time">排查对象：{{ info.place }}</view>
            <view class="time">排查时间：{{ info.checkTime }}</view>
            <view class="time">排查人员：{{ info.checkPerson }}</view>
            <view class="time">是否存在涉及ZJ内容：:{{ info.contentFlag == 1 && '是' || '否' }}</view>
            <view class="time">是否建造ZJ造像和大型ZJ标识：{{ info.statueFlag == 1 && '是' || '否' }}</view>
            <view class="time">具体负责人是否存在信教情况：{{ info.responsibleBelieveFlag == 1 && '是' || '否' }}</view>
            <view class="time">工作人员是否存在信教情况：{{ info.workerBelieveFlag == 1 && '是' || '否' }}</view>
        </view>
        <!-- 各单位端/网格员端/统战部/tzwy 线索反馈 -->
        <view v-else-if="(userInfo.roleCode == 'tzwy' || userInfo.roleCode == 'tzb' || userInfo.roleCode == 'gdw' || userInfo.roleCode == 'wgy') && type == 'xs'" class="infobox">
            <view class="title">
                <view class="head">
                    <p style="margin-bottom: 10rpx;">详情如下</p>
                </view>
                <!-- <tui-tag type="danger" padding="10rpx 14rpx" size="26rpx">{{ info.status==0 && '未完成' || '已完成' }}</tui-tag> -->
            </view>
            <view class="time">完成状态：<text :class="[info.status==0 && 'red' || 'green']">{{ info.status==0 && '未完成'||'已完成' }}</text></view>
            <view class="time">乡镇街道：{{ info.town }}</view>
            <view class="time">村社区：{{ info.village }}</view>
            <view class="time">反馈人：{{ info.feedbackPerson }}</view>
            <view class="time">反馈时间：{{ info.feedbackTime }}</view>
            <view class="time">事发地点：{{ info.place }}</view>
            <view class="time">情况描述：{{ info.description }}</view>
        </view>
        <view v-else>未知</view>

        <view class="btn" v-if="(userInfo.roleCode !== 'gdw' && userInfo.roleCode !== 'wgy') && type=='xs' && info.status==0">
            <button width="70%" @click="open = true, showType = 1">流转</button>
            <!-- <button width="70%" class="plain">驳回</button> -->
        </view>

        <view class="btn1" v-if="(userInfo.roleCode == 'gdw' || userInfo.roleCode == 'wgy') && type=='xs' && info.status==0">
            <button class="back" width="70%" @click="open = true, showType = 2">办结反馈</button>
        </view>

        <tui-modal :show="open" custom>
            <!-- 流转模块 -->
            <view v-if="showType == 1" class="tui-modal-custom">
                <view style="padding: 1rem 0; text-align: center; font-size: 30rpx;">任务已成功接收，请及时流转</view>
                <view style="font-size: 30rpx; margin-bottom: 20rpx;">流转至:</view>
                <multiSelect style="width: 100%;" :list="list" :selVal="selVal" @changee="bb"></multiSelect>
                <view class="btn2">
                    <button height="80rpx" :size="28" @click="clueTransfer">确定</button>
                    <button height="80rpx" :size="28" @click="open = false" class="plain">取消</button>
                </view>
            </view>

            <!-- 办结模块 -->
            <view v-if="showType == 2" class="tui-modal-custom">
                <view style="padding: 1rem 0; text-align: center; font-size: 30rpx;">任务已成功接收，请办结反馈</view>
                <view class="flex">
                    <text style="font-size: 30rpx;">情况反馈:</text>
                    <textarea class="textarea" placeholder="请输入具体反馈情况" v-model="mask"></textarea>
                </view>
                <radio-group class="radio" @change="(evt) => { dealStatus = evt.detail.value }">
                    <radio value="1" :checked="dealStatus === '1'" />已办结<text class="left"></text>
                    <radio value="0" :checked="dealStatus === '0'" />未办结<text class="left"></text>
                    <radio value="3" :checked="dealStatus === '3'" />需联合办结
                </radio-group>
                <view class="btn2">
                    <button height="80rpx" :size="28" @click="clueDeal">确定</button>
                    <button height="80rpx" :size="28" @click="open = false" class="plain">取消</button>
                </view>
            </view>
        </tui-modal>
    </view>
</template>

<script>
import {
    mapState,
    mapGetters,
    mapMutations
} from 'vuex'
import mClockIn from "@/components/hq-ui/m-clock-in"
import indexConfig from "@/config/index.config.js"
import multiSelect from "./multiSelect"

export default {
    components: {
        mClockIn, multiSelect
    },
    data() {
        return {
            type: '',
            curId: '',
            dealStatus: '1',
            mask: '',
            list: [
                { id: 1, adminName: 1212, show: false },
            ],
            selVal: [],
            showType: 1, // 办结2 流转1
            open: false,
            info: {},
        }
    },
    computed: {
        ...mapGetters(['tabBar', "hasLogin"]),
        ...mapState(["isUserPhone", 'userInfo']),
    },
    onLoad(opt) {
        let { id, type } = opt;
        this.curId = id;
        this.type = type;
        // gdw wgy 办结 其他都是流转
        // 各单位端 专项巡查 线索反馈
        // 网格员端 一周巡查 线索反馈
        this.getSelect();//统战部
        if (this.userInfo.roleCode == 'wgy' || this.userInfo.roleCode == 'tzb' || this.userInfo.roleCode == 'tzwy') {
            type == 'yz' && this.weekDesc(id);
            type == 'xs' && this.clueDesc(id);
        } else if (this.userInfo.roleCode == 'gdw') {
            type == 'zx' && this.specDesc(id);
            type == 'xs' && this.clueDesc(id);
        } else {
            
        }
    },
    onUnload() {

    },
    onShow() {

    },
    methods: {
        back() {
            uni.navigateBack({
                delta: 1
            })
        },
        weekDesc(id) {
            this.$apis.weekCheckDesc(id).then(res => {
                this.info = res.data;
            })
        },
        specDesc(id) {
            this.$apis.specialCheckDesc(id).then(res => {
                this.info = res.data;
            })
        },
        clueDesc(id) {
            this.$apis.clueDesc(id).then(res => {
                this.info = res.data;
            })
        },
        //  各单位端 线索反馈 流转
        clueTransfer() {
            this.$api.showLoading();
            this.$apis.clueTransfer({
                "bizId": this.curId, //线索id
                "userIds": this.selVal.map(i => i.id), //用户id
            }).then(res => {
                this.$api.hideLoading();
                this.$api.msg(res.message);
                this.open = false;
            })
        },

        // 各单位端 线索反馈 办结
        clueDeal() {
            this.$api.showLoading();
            this.$apis.clueDeal({
                "clueId": this.curId, // 线索id
                "dealStatus": (this.dealStatus== 3 ? 1: this.dealStatus), // 完结状态
                "dealOpinion": this.mask //情况反馈
            }).then(res => {
                this.$api.hideLoading();
                this.$api.msg(res.message);
                this.open = false
                this.clueDesc(this.curId);
            })
        },

        desc(id) {
            this.$apis.listDesc(id).then(res => {
                this.info = res.data;

            })
        },
        getSelect() {
            this.$apis.completionData().then(res => {
                this.list = res.data;
            })
        },
        bb(data) {
            this.selVal = data.a;
            this.list = data.b;
        },

    },


}
</script>

<style lang="scss">
page {
    background: #fff;
    height: 100%;
}
.infobox {
    .time {
        margin: 20rpx 30rpx;
        font-size: 30rpx;
    }
}

.flex {
    display: flex;
    align-items: center;
}

.radio {
    margin: 30rpx 0;
}

.left {
    margin-right: 20rpx;
}

.textarea {
    width: 70%;
    border: 1px solid #999;
    height: 6rem;
    padding: 10rpx;
    margin-left: 10rpx;
    border-radius: 10rpx;
}

.viewBox {
    position: relative;
    height: 100%;
}

.desc {
    p {
        margin: 40rpx 0;
        color: #999;
    }
}
.btn1 {
    margin-top: 80rpx;
}

.btn,
.btn2 {
    display: flex;

    button {
        width: 40%;
        height: 80rpx;
        line-height: 80rpx;
        background: #2a75f3;
        color: #fff;
    }

    .plain {
        background: #fff;
        color: #2a75f3;
        border: 1px solid #2a75f3;
    }
}

.btn {
    position: absolute;
    bottom: 6rem;
    width: 700rpx;
    justify-content: space-around;
}

.btn2 {
    position: relative;
    width: 100%;
    justify-content: space-between;
    margin-top: 4rem;
}

.back {
    background: #2a75f3;
    color: #fff;
    width: 40%;
    height: 70rpx;
    line-height: 70rpx;
}

.title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20rpx 40rpx;
}

.head {
    p {
        font-size: 38rpx;
        font-weight: bold;
        margin: 20rpx 0;
    }
}
.red {
    color: #fff;
    background: red;
    padding: 4rpx;
    border-radius: 6rpx;
}
.green {
    color: #fff;
    background: green;
    padding: 4rpx;
    border-radius: 6rpx;
}
</style>